'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
  async index() {
    this.ctx.body = 'index';
  }

  async blog() {
    let pageNumber = this.ctx.params.num || 1;
    const blogs = await this.ctx.service.blog.getBlogs(pageNumber);
    await this.ctx.render('blog', {'blogs': blogs.list});
  }
}

module.exports = HomeController;
